//
// Notes to End Users.
//
// The workflow should run without editing this configuration file,
// however there may be instances in which you wish to edit this
// file for compute performance or other reasons. Please see:
//
//   https://nextflow.io/docs/latest/config.html#configuration
//
// for further help editing this file.


params {
    help = false
    version = false
    fastq = null
    bam = null
    sample = null
    sample_sheet = null
    classifier = "minimap2"
    exclude_host = null
    // Advanced_options
    max_len = 2000
    min_len = 800
    min_read_qual = null
    threads = 4
    server_threads = 2
    kraken_clients = 2
    // Databases
    taxonomy = null
    reference = null
    ref2taxid = null
    database = null
    taxonomic_rank = 'G'
    // Minimap
    minimap2filter = null
    minimap2exclude = false
    keep_bam = false
    minimap2_by_reference = false
    min_percent_identity = 95
    min_ref_coverage = 90
    // Output
    store_dir = "store_dir"
    out_dir = "output"
    include_read_assignments = false
    // Extra features
    igv = false
    output_unclassified = false
    // Kraken
    bracken_length = null
    bracken_threshold = 10
    port = 8080
    host = "localhost"
    external_kraken2 = false
    kraken2_memory_mapping = false
    kraken2_confidence = 0
    // Real time
    batch_size = 0
    real_time = false
    read_limit = null
    // Databases
    database_set = "ncbi_16s_18s"
    database_sets = [
        'ncbi_16s_18s': [
            'reference': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-metagenomics/ncbi_16s_18s/ncbi_targeted_loci_16s_18s.fna',
            // database already includes kmer_dist_file
            'database': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-metagenomics/ncbi_16s_18s/ncbi_targeted_loci_kraken2.tar.gz',
            'ref2taxid': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-metagenomics/ncbi_16s_18s/ref2taxid.targloci.tsv',
            'taxonomy': 'https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/taxdump_archive/new_taxdump_2025-01-01.zip'
        ],
        'ncbi_16s_18s_28s_ITS': [
            'reference': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-metagenomics/ncbi_16s_18s_28s_ITS/ncbi_16s_18s_28s_ITS.fna',
            'database': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-metagenomics/ncbi_16s_18s_28s_ITS/ncbi_16s_18s_28s_ITS_kraken2.tar.gz',
            'ref2taxid': 'https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-metagenomics/ncbi_16s_18s_28s_ITS/ref2taxid.ncbi_16s_18s_28s_ITS.tsv',
            'taxonomy': 'https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/taxdump_archive/new_taxdump_2025-01-01.zip'
        ],
        'SILVA_138_1': [
            // It uses the taxids from the Silva database, which doesn't match the taxids from NCBI
            // Database create from scratch using kraken2-build command. It automatically downloads the files.
            'database': null
        ]
    ]
    // Report options
    abundance_threshold = 1
    n_taxa_barplot = 9
    // AMR options
    amr = false
    amr_db = "resfinder"
    amr_minid = 80
    amr_mincov = 80
    // AWS
    aws_image_prefix = null
    aws_queue = null
    // Other options
    disable_ping = false
    monochrome_logs = false
    validate_params = true
    show_hidden_params = false
    analyse_unclassified = false
    schema_ignore_params = 'show_hidden_params,validate_params,monochrome_logs,aws_queue,aws_image_prefix,wf,database_sets,amr,amr_db,amr_minid,amr_mincov'

    // Workflows images
    wf {
        example_cmd = [
            "--fastq 'wf-16s-demo/test_data'",
            "--minimap2_by_reference"
        ]
        agent = null
        container_sha = "shaafb4d0a17809e7be380620c7c601d49949042b75"
        common_sha = "sha9ef2f4e4585c4ce6a604616e77185077551abf50"
    }
}


manifest {
    name            = 'epi2me-labs/wf-16s'
    author          = 'Oxford Nanopore Technologies'
    homePage        = 'https://github.com/epi2me-labs/wf-16s'
    description     = 'Taxonomic classification of 16S rRNA gene sequencing data.'
    mainScript      = 'main.nf'
    nextflowVersion = '>=23.04.2'
    version         = 'v1.5.0'
}


epi2melabs {
    tags = "wf-16s,targeted,16S,18S,ITS,bacteria,fungi,metagenomics"
}

// used by default for "standard" (docker) and singularity profiles,
// other profiles may override.
process {
    withLabel:wfmetagenomics {
        container = "ontresearch/wf-metagenomics:${params.wf.container_sha}"
    }
    withLabel:wf_common {
        container = "ontresearch/wf-common:${params.wf.common_sha}"
    }
    shell = ['/bin/bash', '-euo', 'pipefail']
}


profiles {
    // the "standard" profile is used implicitely by nextflow
    // if no other profile is given on the CLI
    standard {
        docker {
            enabled = true
            // this ensures container is run as host user and group, but
            //    also adds host user to the within-container group
            runOptions = "--user \$(id -u):\$(id -g) --group-add 100"
        }
    }

    // using singularity instead of docker
    singularity {
        singularity {
            enabled = true
            autoMounts = true
        }
    }


    conda {
        conda.enabled = true
    }

    // Using AWS batch.
    // May need to set aws.region and aws.batch.cliPath
    awsbatch {
        process {
            executor = 'awsbatch'
            queue = "${params.aws_queue}"
            memory = '16G'
            withLabel:wfmetagenomics {
                container = "${params.aws_image_prefix}-wf-metagenomics:${params.wf.container_sha}"
            }
            withLabel:wf_common {
                container = "${params.aws_image_prefix}-wf-common:${params.wf.common_sha}"
            }
            shell = ['/bin/bash', '-euo', 'pipefail']
        }
    }

    // local profile for simplified development testing
    local {
        process.executor = 'local'
    }
}


timeline {
    enabled = true
    overwrite = true
    file = "${params.out_dir}/execution/timeline.html"
}
report {
    enabled = true
    overwrite = true
    file = "${params.out_dir}/execution/report.html"
}
trace {
    enabled = true
    overwrite = true
    file = "${params.out_dir}/execution/trace.txt"
}

env {
	PYTHONNOUSERSITE = 1
    JAVA_TOOL_OPTIONS = "-Xlog:disable -Xlog:all=warning:stderr"
}
